package com.mine.dzq.service.application;

import com.mine.dzq.service.StorageService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.io.InputStream;

/**
 * @Author Pudding
 * 业务层使用
 * @Date 2025/4/7 11:18
 */
@Service
@RequiredArgsConstructor
public class FileService {
    private final StorageService storageService;

    public void uploadFile(String objectKey, InputStream inputStream) {
        try {
            storageService.upload(objectKey, inputStream);
        } catch (Exception e) {
            // 处理异常，例如记录日志或抛出业务异常
            throw new RuntimeException("文件上传失败", e);
        }
    }
}